package org.infodavid.common.services.exceptions;


/**
 * The Class DuplicatedEntityException.
 */
public class DuplicatedEntityException extends ServiceException {

	/** serialVersionUID. */
	private static final long serialVersionUID = -3944718621660392065L;

	/** The identifier. */
	private final Object identifier;

	/** The type. */
	@SuppressWarnings("rawtypes")
	private final Class type;

	/**
	 * The Constructor.
	 * @param arg0 the entity type
	 * @param arg1 the entity identifier (the one used to detect duplicated data)
	 */
	@SuppressWarnings("rawtypes")
	public DuplicatedEntityException(final Class arg0, final Object arg1) {
		super("Duplicated entity: " + arg0.getName() + " (" + arg1 + ')');

		type = arg0;
		identifier = arg1;
	}

	/**
	 * Gets the identifier (the one used to detect duplicated data).
	 * @return the identifier
	 */
	public Object getIdentifier() {
		return identifier;
	}

	/**
	 * Gets the type.
	 * @return the type
	 */
	@SuppressWarnings("rawtypes")
	public Class getType() {
		return type;
	}
}
